package ScratchPad
{
	import flash.events.MouseEvent;
	
	import mx.containers.Canvas;
	import mx.controls.Image;
	import mx.controls.Label;
	import mx.controls.TextArea;
	
	public class oddPagePanel extends Canvas
	{
		public var NextPage:Image;
	    public var PreviousPage:Image;
		private var binding:Image;
		public var PageNo:uint;
		public var textPanel:TextArea;
		public var scratchPad:Object;
		public function oddPagePanel(SP:Object,PNo:uint)
		{
			scratchPad=SP;
			this.setStyle("backgroundColor","#FDFBFB");
			this.PageNo=PNo;
			//this.layout="absolute";
			this.x=0;
			this.y=0;
			this.width=350;
			this.height=450;
			textPanel=new TextArea;
			textPanel.x=this.width/7+8;
			textPanel.y=20;
			textPanel.width=this.width-60;
			textPanel.height=this.height-40;
			textPanel.setStyle("borderStyle","none");
			textPanel.text="Type Text Here";
			textPanel.setStyle("fontSize","15");
			binding=new Image();
			binding.autoLoad=true;
			binding.source="Assets/icons/scratchPadIcons/notebook.jpg";
			binding.x=0;
			binding.y=0;
			binding.height=this.height;
			binding.width=this.width/7;
			NextPage= new Image();
			NextPage.toolTip="Next Page";
			NextPage.autoLoad=true;
			NextPage.source="Assets/icons/scratchPadIcons/right_arrow.png";
			NextPage.x=this.width-20;
			NextPage.y=this.height-20;
			NextPage.width=20;
			NextPage.height=20;
			NextPage.addEventListener(MouseEvent.CLICK,openNextPage);	
			PreviousPage= new Image();
			PreviousPage.toolTip="Previous Page";
			PreviousPage.autoLoad=true;
			PreviousPage.source="Assets/icons/scratchPadIcons/left_arrow.png";
			PreviousPage.x=this.width/7+8;
			PreviousPage.y=this.height-20;
			PreviousPage.width=20;
			PreviousPage.height=20;
			PreviousPage.addEventListener(MouseEvent.CLICK,openPreviousPage);
			var PageNoLabel:Label=new Label();
			PageNoLabel.data=""+PageNo;
			PageNoLabel.x=(this.width)/2;
			PageNoLabel.y=this.height-20;
			this.addChild(textPanel);
			this.addChild(binding);
			this.addChild(PageNoLabel);
			this.addChild(NextPage);
				this.addChild(PreviousPage);
		}
       public function openNextPage(evt:MouseEvent)
       {
       scratchPad.OpenNextPage(this,PageNo);
       }
       public function openPreviousPage(evt:MouseEvent)
       {
       	scratchPad.OpenPreviousPage(this,PageNo);
       }
	}
}